package com.wyk.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author WangYuKai
 * @Date 2022/7/11
 * @apiNote
 */
@Configuration
public class GateWayConfig {
    @Bean
    public RouteLocator getLocator(RouteLocatorBuilder routeLocatorBuilder){//路由构建器
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("path_route",r ->r.path("guonei").uri("http://news.baidu.com/guonei")).build();
        return  routes.build();
    }
}
